package com.ruoyi.user.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.user.mapper.UserViewRecordMapper;
import com.ruoyi.user.domain.UserViewRecord;
import com.ruoyi.user.service.IUserViewRecordService;

/**
 * 用户浏览记录Service业务层处理
 * 
 * @author DEREK
 * @date 2023-05-12
 */
@Service
public class UserViewRecordServiceImpl extends ServiceImpl<UserViewRecordMapper, UserViewRecord> implements IUserViewRecordService 
{
    @Autowired
    private UserViewRecordMapper userViewRecordMapper;

    /**
     * 查询用户浏览记录
     * 
     * @param id 用户浏览记录主键
     * @return 用户浏览记录
     */
    @Override
    public UserViewRecord selectUserViewRecordById(Long id)
    {
        return userViewRecordMapper.selectUserViewRecordById(id);
    }

    /**
     * 查询用户浏览记录列表
     * 
     * @param userViewRecord 用户浏览记录
     * @return 用户浏览记录
     */
    @Override
    public List<UserViewRecord> selectUserViewRecordList(UserViewRecord userViewRecord)
    {
        return userViewRecordMapper.selectUserViewRecordList(userViewRecord);
    }

    /**
     * 新增用户浏览记录
     * 
     * @param userViewRecord 用户浏览记录
     * @return 结果
     */
    @Override
    public int insertUserViewRecord(UserViewRecord userViewRecord)
    {
        userViewRecord.setCreateTime(DateUtils.getNowDate());
        return userViewRecordMapper.insertUserViewRecord(userViewRecord);
    }

    /**
     * 修改用户浏览记录
     * 
     * @param userViewRecord 用户浏览记录
     * @return 结果
     */
    @Override
    public int updateUserViewRecord(UserViewRecord userViewRecord)
    {
        userViewRecord.setUpdateTime(DateUtils.getNowDate());
        return userViewRecordMapper.updateUserViewRecord(userViewRecord);
    }

    /**
     * 批量删除用户浏览记录
     * 
     * @param ids 需要删除的用户浏览记录主键
     * @return 结果
     */
    @Override
    public int deleteUserViewRecordByIds(Long[] ids)
    {
        return userViewRecordMapper.deleteUserViewRecordByIds(ids);
    }

    /**
     * 删除用户浏览记录信息
     * 
     * @param id 用户浏览记录主键
     * @return 结果
     */
    @Override
    public int deleteUserViewRecordById(Long id)
    {
        return userViewRecordMapper.deleteUserViewRecordById(id);
    }
}
